package com.springbootblog.controller.fontend;

import com.springbootblog.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * webscoket部分接口
 * @className AboutController
 * @author camellia
 * @email 805795955@qq.com
 * @date 2024/01/01
 * @version 1.0
 */
@RestController
@RequestMapping("/java")
//@CrossOrigin(origins="*",maxAge=3600)
public class WebScoketController
{
    @Autowired
    private RedisUtil redisUtil;


    @RequestMapping("set")
    public boolean redisset(@RequestParam(defaultValue = "") String key,@RequestParam(defaultValue = "") String value)
    {
        System.out.println(key+"--"+value);
        return redisUtil.set(key,value);
    }

    @RequestMapping("get")
    public Object redisget(@RequestParam(defaultValue = "") String key){
        System.out.println(redisUtil.get(key));
        return redisUtil.get(key);
    }

    @RequestMapping("expire")
    public boolean expire(@RequestParam(defaultValue = "") String key,@RequestParam(defaultValue = "") long ExpireTime){
        return redisUtil.expire(key,ExpireTime);
    }
}//*/